package server;

import java.io.IOException;

public class PineServlet extends HttpServlet {

    @Override
    public void doGet(Request request, Response response) {
        String content = "<h1>mini: PineServlet get</h1>";
        try {
            response.output((HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // post方法被调用的时候，返回post的方法被调用
    @Override
    public void doPost(Request request, Response response) {
        String content = "<h1>mini: PineServlet post</h1>";
        try {
            response.output((HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destory() throws Exception {

    }
}